<?php

namespace app\admin\validate\Coupon;

use think\Validate;

class Premium extends Validate
{
    protected $rule = [
        'id'            =>  'require',
        'value'         =>  'require|min:1',
        'premium_rate'  =>  'require|float|egt:0',
        'status'        =>  'require|in:1,0',
        'config_type'   =>  'require|in:1,2,3',
        'global'        =>  'require|in:1,2,3',
        'type'          =>  'require|in:1,2',
    ];

    protected $message = [
        'id.require'            =>  'id不能为空',
        'value.require'         =>  '溢价比例不能为空',
        'premium_rate.require'  =>  '溢价比例不能为空',
        'premium_rate.number'   =>  '溢价比例必须是数值类型',
        'premium_rate.egt'      =>  '溢价比例最小是0',
        'status.require'        =>  '单个商品设置溢价类型不能为空',
        'status.in'             =>  '单个商品设置溢价类型只能是0,1',
        'config_type.require'   =>  '为单个商品设置溢价参数类型不能为空',
        'config_type.in'        =>  '为单个商品设置溢价参数类型只能是1,2,3',
        'global.require'        =>  '全局设置溢价类型参数不能为空',
        'global.in'             =>  '全局设置溢价类型参数只能是1,2,3',
        'type.require'          =>  '为全局还是单个商品设置溢价参数不能为空',
    ];

    protected $scene = [
        'common'     =>  ['type','premium_rate'],
        'global'     =>  ['global'],
        'config_set' =>  ['config_type', 'status'],
    ];
}
